package com.hshoesmall.demo.controller;
import com.hshoesmall.demo.common.api.ApiErrorCode;
import com.hshoesmall.demo.common.api.ApiResult;
import com.hshoesmall.demo.model.entity.Brand ;
import com.hshoesmall.demo.mapper.BrandsMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.lang.reflect.Type;
import java.util.*;

//写接口的地方 提供交互的方法
@RestController //将数据渲染成json字符串
@RequestMapping("/brands") //接口路径
public class BrandsController {
    //    test
    @Resource
    BrandsMapper brandsMapper;
// 获取所有品牌接口
    @PostMapping("/getAllBrands") //get请求
    public ApiResult<List<Brand>> getBrands(){
        brandsMapper.findAllBrands();
        List<Brand> allBrands = brandsMapper.findAllBrands();
        return ApiResult.success(allBrands) ;
    }

}

